<include file="Public:header" />



<div class="container main"> <include file="Public:left" />
  <div class="w790">
  <script>
  	function uploaded(path){
		$("#img_url").attr("src",'__PUBLIC__'+path);
		$("input[name='img_url']").val(path);
	}
	function del_img(){
		if(confirm('您确定要删除图片吗?')){
			var file=$("input[name='img_url']").val();
			$.post("{:U('delImgBypath')}",{'path':file},function(data){
				$("input[name='img_url']").val('');
				$("#img_url").attr('src','');
			});
		}else{
			return false;
		}
	}
	
	//删除图组图片
	function mdel_img(path){
		$('#img_list div img').each(function(index, element) {
			$.post("{:U('delImgBypath')}",{'path':path},function(data){
				if(data=='OK'){
					 
					$('#img_list div').each(function(index, element) {
                        if($(this).attr('url')==path){
							$(this).remove();
						}
                    });
					
					$('#picmsg input').each(function(index, element) {
                        if($(this).val()==path){
							$(this).remove();
						}
                    });
				}
			});
		});
	}

	function relateids(){
				art.dialog.data('relateidsBox',$('#relateids'));
				art.dialog.open('{:U('selectProduct', array('product_id' => $info['id']))}', {width: 800, height: 500,lock:true,title:'选择关联商品', ok:function(){
					var d = this.iframe.contentWindow.document;
			    }});
			}
	$(document).ready(function(e) {
    $('#control li').each(function(index, element) {
        $(this).click(function(e) {
			$(this).parent().find('li').removeClass('cur');
            $(this).addClass('cur');
			$('.setting_table').hide();
			$('.setting_table').eq(index).show();
        });
    });
});
	//切换栏目方式 
	function parseCateType(e){
		if($(e).val()==1){
			$('#pagesize').show();
		}else{
			$('#pagesize').hide();
		}
	}
	function after(e){
	    $(e).parent().parent().parent().parent().parent('li').after($(e).parent().parent().parent().parent().parent('li').prev());
    }
    function append(e){
	    $(e).parent().parent().parent().parent().parent('li').next().after($(e).parent().parent().parent().parent().parent('li'));
    }
	function delnews(e){
		$(e).parent().parent().parent().parent().parent().remove();
	}
	function addnews(){
		var html = $('#copyHTML').html();
		$(html).appendTo('#replyList ul');
	}
  </script>
  <style>
  	#replyList ul li{margin-top:5px; background:#eee; padding:8px; width:700px;}
	.delnews{display:block; width:30px; font-size:20px; height:30px; border-radius:15px; background:#f00; color:#fff; line-height:30px; text-align:center;}
  </style>

 <div class="h"><a href="{:U('index')}" class="btn btn-info"><i class="glyphicon glyphicon-circle-arrow-left"></i> 返回列表</a>
 
 </div>
 <style>#control{border-bottom:1px solid #558fca; margin-bottom:10px;}
		#control li{float:left; height:40px; line-height:40px; border:1px solid #558fca; border-bottom:none;}
		#control li a{padding:0px 8px;}
		#control li.cur{background:#558fca;}
		#control li.cur a{color:#fff; font-weight:bold;}
		.relateListdel{display:inline-block; width:20px; height:20px; text-align:center; font-size:18px; cursor:default;}
	</style>
   <ul id="control"><li class="cur"><a href="javascript:void(0);">基础内容</a></li>
   <volist name="extendsField" id="vo">
   	<li><a href="javascript:void(0);">{$vo.title}</a></li>
   </volist>
   <div class="clear"></div>
   </ul>
 
    <form class="checkoutform form-horizontal" action="{:U('update')}" method="post">
      <div class="table_ container">
      
      <input type="hidden" name="id" value="{$info.id}">
      
      
  
     <div class="setting_table"><div class="form-group">
      <label class="col-sm-2 control-label">商品名称　<div class="pull-right popover-info"> <i class="glyphicon glyphicon-question-sign "></i>
                <div class="popover fade right">
                  <div class="arrow"></div>
                  <h3 class="popover-title">帮助</h3>
                  <div class="popover-content"> 将组件元素拖放入你需要放入的栅格列中。之后，你可以设置该元素的样式。</div>
                </div>
              </div></label>
      <div class="col-sm-10">
         <input class="form-control" datatype="*"  name="title" value="{$info.title}" id="title" type="text">
      </div>
   </div>
    
      <div class="form-group">
      <label class="col-sm-2 control-label">商品货号</label>
      <div class="col-sm-10">
         <input class="form-control" name="code" id="code" type="text" value="{$info.code}">
      </div>
   </div>
    
     
        <div class="form-group">
      <label class="col-sm-2 control-label">简述</label>
      <div class="col-sm-10">
         <textarea class="form-control" name="remark" class="" cols="50" rows="6" id="remark">{$info.remark}</textarea>
      </div>
   </div>
      <notempty name="$category">
      <div class="form-group">
      <label class="col-sm-2 control-label">所属分类</label>
      <div class="col-sm-10">
         <select class="form-control" datatype="*" name="category_id" id="category_id">
          <option value="">请选择</option>
          <volist name="cate_list" id="vo">
           <eq name="vo['is_list']" value="1">
            <option <eq name="vo['id']" value="$info['category_id']">selected="selected"</eq> value="{$vo.id}">{:getdeepstr($vo['deep'])}{$vo.title}</option></eq>
          </volist>
        </select>
      </div>
   </div>
   <else/>
   <input type="hidden" name="category_id" value="{$category_id}" >
   </notempty>
   <notempty name="brandList">
   <div class="form-group">
      <label class="col-sm-2 control-label">品牌</label>
      <div class="col-sm-10">
         <select class="form-control" name="brand_id" id="brand_id">
          <option value="">请选择</option>
          <volist name="brandList" id="vo">

            <option <eq name="vo['id']" value="$info['brand_id']">selected="selected"</eq> value="{$vo.id}">{$vo.title}</option>
          </volist>
        </select>
      </div>
   </div>
   </notempty>
   <notempty name="couponList">
   <div class="form-group">
      <label class="col-sm-2 control-label">送优惠券</label>
      <div class="col-sm-10">
         <select class="form-control" name="coupon_id" id="coupon_id">
          <option value="">请选择</option>
          <volist name="couponList" id="vo">

            <option <eq name="vo['id']" value="$info['coupon_id']">selected="selected"</eq> value="{$vo.id}">{$vo.title}</option>
          </volist>
        </select>
      </div>
   </div>
   </notempty>
    <notempty name="serviceccardList">
   <div class="form-group">
      <label class="col-sm-2 control-label">送服务卡券</label>
      <div class="col-sm-10">
         <select class="form-control" name="servicecard_id" id="servicecard_id">
          <option value="">请选择</option>
          <volist name="serviceccardList" id="vo">

            <option <eq name="vo['id']" value="$info['servicecard_id']">selected="selected"</eq> value="{$vo.id}">{$vo.title}</option>
          </volist>
        </select> 
      </div>
   </div>
   </notempty>
    <div class="form-group">
      <label class="col-sm-2 control-label">供货商</label>
      <div class="col-sm-10">
         <select class="form-control" name="supplier_id" id="supplier_id">
          <option value="">请选择</option>
          <volist name="SupplierList" id="vo">
           
            <option <eq name="vo['id']" value="$info['supplier_id']">selected="selected"</eq> value="{$vo.id}">{$vo.susername}<switch name="vo.type"><case value="1">(线上)</case><case value="2">(线下)</case></switch></option>
          </volist>
        </select>
      </div>
   </div>
   <div class="form-group">
      <label class="col-sm-2 control-label">商品分类</label>
      <div class="col-sm-10">
            <select class="form-control" name="category_id" id="category_id">
                <option value="">请选择</option>
                <volist name="cate_list" id="vo">
                <option <eq name="info['category_id']" value="$vo['id']">selected="selected"</eq> value="{$vo.id}">{:getdeepstr($vo['deep'])}{$vo.title}
                </volist>
            </select>
      </div>
   </div>
   
    <div class="form-group">
      <label class="col-sm-2 control-label">扩展分类</label>
      <div class="col-sm-10">
      <volist name="categorylist" id="vo">
      <?php $deep = $categorylist[$key - 1]['deep']; if($deep != $vo['deep']){?><br>
<?php }?>
         <label class="checkbox-inline"> <input <?php if(in_array($vo['id'], $categorylistids)){?>checked<?php }?> type="checkbox" name="category_goods[]" value="{$vo.id}" id="is_nav_2" />
          {$vo.title}</label>
           </volist>
          </div>
          </div>
         <div class="form-group">
             <label class="col-sm-2 control-label">价格</label>
             <div class="col-sm-10">
                 <input class="form-control" datatype="*"  name="price" value="{$info.price}" id="price" type="text">
             </div>
         </div>
       <!--  <div class="form-group">
             <label class="col-sm-2 control-label">商家返利比例 （%）</label>
             <div class="col-sm-10">
                 <input class="form-control" datatype="*"  name="Merchantrebates" value="{$info.Merchantrebates|default='0'}" id="Merchantrebates" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-2 control-label">消费者返利比例 （%）</label>
             <div class="col-sm-10">
                 <input class="form-control" datatype="*"  name="Consumerebates" value="{$info.Consumerebates|default='0'}" id="Consumerebates" type="text">
             </div>
         </div>-->
         
         <div class="form-group">
             <label class="col-sm-2 control-label">参与系类</label>
             <div class="col-sm-10">
                 <select class="form-control" name="RebateModel" id="RebateModel">
                     <option value="">请选择</option>
                     <option <eq name="info['RebateModel']" value="1">selected="selected"</eq> value="1">8%系列</option>
                     <option <eq name="info['RebateModel']" value="2">selected="selected"</eq> value="2">16%系列</option>
                     <?php if($_SESSION['authId']==1){ ?>
                     <option <eq name="info['RebateModel']" value="3">selected="selected"</eq> value="3">2%系列</option>
                      
                     <option <eq name="info['RebateModel']" value="4">selected="selected"</eq> value="4">4%系列</option>
                   
                     <?php }?>
                 </select>
             </div>
         </div>
    <if condition="getAccessMenu($accessList, 'Admin', 'Member', 'addintegral')"><div class="form-group">
      <label class="col-sm-2 control-label">赠送积分</label>
      <div class="col-sm-10">
         <input class="form-control" name="socre" value="{$info.socre}" id="socre" type="text">
      </div>
   </div></if>

   


   

   <div class="form-group">
      <label class="col-sm-2 control-label">折扣率</label>
      <div class="col-sm-10">
         <input class="form-control" name="discount" value="{$info.discount}" id="discount" type="text">
      </div>
   </div>

     <div class="form-group">
         <label class="col-sm-2 control-label">原价</label>
         <div class="col-sm-10">
             <input class="form-control"  name="originalCost" value="{$info.originalCost}" id="originalCost" type="text">
         </div>
     </div>


         <script>
             $('#price,#discount').change(function(){
                 $('#originalCost').val(($('#price').val()/$('#discount').val()).toFixed(2));
             });
             $('#originalCost').change(function(){
                 $('#discount').val(($('#price').val()/$('#originalCost').val()).toFixed(2));
             });
         </script>
   
   
   <div class="form-group">
      <label class="col-sm-2 control-label">成本价</label>
      <div class="col-sm-10">
         <input class="form-control" datatype="*"  name="cost" value="{$info.cost}" id="cost" type="text">
      </div>
   </div>
   
   
  <!-- <div class="form-group">
      <label class="col-sm-2 control-label">分成金额</label>
      <div class="col-sm-10">
         <input class="form-control" datatype="*"  name="affmoney" value="{$info.affmoney}" id="affmoney" type="text">
      </div>
   </div>-->
   
   
   
   <div class="form-group">
      <label class="col-sm-2 control-label">奖金池金额</label>
      <div class="col-sm-10">
         <input class="form-control" datatype="*"  name="commision" value="{$info.commision}" id="commision" type="text">
      </div>
   </div>
   
   
   
   
   <div class="form-group">
      <label class="col-sm-2 control-label">重量[kg]</label>
      <div class="col-sm-10">
         <input class="form-control" datatype="*" name="weight" value="{$info.weight}" id="weight" type="text">
      </div>
   </div>
   <div class="form-group">
      <label class="col-sm-2 control-label">单位[如：斤]</label>
      <div class="col-sm-10">
         <input class="form-control" name="unit" value="{$info.unit}" id="unit" type="text">
      </div>
   </div>
   <div class="form-group">
      <label class="col-sm-2 control-label">限购[0不限]</label>
      <div class="col-sm-10">
         <input class="form-control" name="limitBuy" value="{$info.limitBuy}" id="limitBuy" type="text">
      </div>
   </div>
   
   <div class="form-group">
      <label class="col-sm-2 control-label">最小购买量</label>
      <div class="col-sm-10">
         <input class="form-control" name="minBuy" value="{$info.minBuy}" id="minBuy" type="text">
      </div>
   </div>
   
   
   <div class="form-group">
      <label class="col-sm-2 control-label">上架时间</label>
      <div class="col-sm-10">
         <input class="form-control" name="starttime" value="{:date('Y-m-d H:i:s', $info['starttime'])}" id="starttime" type="text">
         
         <div class="alert alert-warning" role="alert" style="margin-top:5px;">
      <strong>温馨提示：</strong> 设置一个自动上架的时间，到达这个时间点商品自动上架，格式是Y-m-d H:i:s(如：2016-07-09 20:00:00)，留空则立即上架
    </div>
         
         
         
      </div>
   </div>
   
   <div class="form-group">
      <label class="col-sm-2 control-label">下架时间</label>
      <div class="col-sm-10">
         <input class="form-control" name="timeout" value="{:date('Y-m-d H:i:s', $info['timeout'])}" id="timeout" type="text">
         
         <div class="alert alert-warning" role="alert" style="margin-top:5px;">
      <strong>温馨提示：</strong> 设置一个自动下架的时间，到达这个时间点商品自动下架，格式是Y-m-d H:i:s(如：2016-07-09 20:00:00)，留空则不会自动下架
    </div>
         
         
         
      </div>
   </div>
   
   <div class="form-group">
      <label class="col-sm-2 control-label">封面图</label>
      <div class="col-sm-10">
         <input name="img_url" type="hidden" value="{$info.img_url}" /><img onclick="showImgBox(this);" src="<notempty name="info['img_url']">{:getThumbPath($info['img_url'])}<else/>__PUBLIC__/Admin/images/defaultimg.png</notempty>" id="img_url" height="40" />
      </div>
   </div>
   
   
   
  
        
        
        
        <div class="form-group">
      <label class="col-sm-2 control-label">上传图组</label>
      <div class="col-sm-10">

      <html:uploadimg name="mimg_url[]" id="mimg_url" num="10" value="$info['mimg_url']"/>
      
      
      
      </div>
   </div>
   
   <div class="form-group">
      <label class="col-sm-2 control-label">商品描述内容</label>
      <div class="col-sm-10">
         <html:editor id="editor" name="content" type="UEDIT" style="height:400px; width:100%;">{$info.content}</html:editor>
      </div>
   </div>
   
    
   <div class="form-group">
      <label class="col-sm-2 control-label">商品属性</label>
      <div class="col-sm-10">
         <html:editor id="attrtext" name="attrtext" type="UEDIT" style="height:300px; width:100%;">{$info.attrtext}</html:editor>
      </div>
   </div>
   
   
   <!--<div class="form-group">-->
      <!--<label class="col-sm-2 control-label">需要物流</label>-->
      <!--<div class="col-sm-10">-->
         <!--<label class="checkbox-inline"> <input name="need_shipping" type="radio" id="is_nav_8" value="1" <eq name="info['need_shipping']" value="1">checked="checked"</eq> />-->
          <!--是</label>-->
          <!--<label class="checkbox-inline">  <input name="need_shipping" type="radio" id="is_nav_9" value="0"  <eq name="info['need_shipping']" value="0">checked="checked"</eq> />-->
          <!--否</label>-->
      <!--</div>-->
      <!--</div>-->
      
      
      <div class="form-group">
      <label class="col-sm-2 control-label">包邮</label>
      <div class="col-sm-10">
         <label class="checkbox-inline"> <input name="noshippingfee" type="radio" id="is_nav_8" value="1" <eq name="info['noshippingfee']" value="1">checked="checked"</eq> />
          是</label>
          <label class="checkbox-inline">  <input name="noshippingfee" type="radio" id="is_nav_9" value="0"  <eq name="info['noshippingfee']" value="0">checked="checked"</eq> />
          否</label>
      </div>
      </div>
      
      
      
      <div class="form-group">
      <label class="col-sm-2 control-label">需要购买后显示详情</label>
      <div class="col-sm-10"><label class="checkbox-inline">  <input name="display" type="radio" id="is_nav_9" value="0" <eq name="info['display']" value="0">checked="checked"</eq> />
          是</label>
         <label class="checkbox-inline"> <input name="display" type="radio" id="is_nav_8" value="1" <eq name="info['display']" value="1">checked="checked"</eq> />
          否</label>
          
      </div>
      </div>
      
      
      
      
      
      
   <!--<div class="form-group">-->
      <!--<label class="col-sm-2 control-label">显示</label>-->
      <!--<div class="col-sm-10">-->
         <!--<label class="checkbox-inline"> <input name="status" type="radio" id="is_nav_8" value="1" checked="checked" />-->
          <!--是</label>-->
          <!--<label class="checkbox-inline">  <input name="status" type="radio" id="is_nav_9" value="0" />-->
          <!--否</label>-->
      <!--</div>-->
      <!--</div>-->
      
      
   <!--<div class="form-group">-->
      <!--<label class="col-sm-2 control-label">分成审核</label>-->
      <!--<div class="col-sm-10">-->
         <!--<label class="checkbox-inline"> <input name="affpass" type="radio" id="is_nav_8" value="0" <eq name="info['affpass']" value="0">checked="checked"</eq> />-->
          <!--需要审核</label>-->
          <!---->
          <!--<label class="checkbox-inline">  <input name="affpass" type="radio" id="is_nav_9" value="1" <eq name="info['affpass']" value="1">checked="checked"</eq> />-->
          <!--直接发红包</label>-->
          <!---->
          <!---->
       <!---->
      <!--</div>-->
      <!--</div>-->
      
      

    <!-- <div class="form-group">
      <label class="col-sm-2 control-label">自动确认</label>
      <div class="col-sm-10">
          
          <label class="checkbox-inline">  <input name="autoconfirm" type="radio" id="autoconfirm" value="1" <eq name="info['autoconfirm']" value="1">checked="checked"</eq> />
          是</label>
          
         <label class="checkbox-inline"> <input name="autoconfirm" type="radio" id="autoconfirm" value="0" <eq name="info['autoconfirm']" value="0">checked="checked"</eq> />
          否</label>
          
       
      </div>
      </div> -->
      <!--<div class="form-group">-->
      <!--<label class="col-sm-2 control-label">谁可以购买</label>-->
      <!--<div class="col-sm-10">-->
          <!---->
         <!---->
          <!--<volist name="getLevelNameList" id="vo">-->
          <!---->
          <!--<label class="checkbox-inline">  <input name="levelBuy" type="radio" id="is_nav_9" value="{$key}" <eq name="info['levelBuy']" value="$key">checked="checked"</eq> />-->
          <!--{$vo}</label>-->
          <!---->
          <!--</volist>-->
          <!---->
          <!---->
         <!---->
         <!---->
       <!---->
      <!--</div>-->
      <!--</div>  -->
      <div class="form-group">
      <label class="col-sm-2 control-label">相联商品</label>
      <div class="col-sm-10">
      <div id="relateids"><volist name="relatelist" id="vo">
      <gt name="vo" value="0">
      <div class="col-sm-3 col-md-3" style="position:relative;"><div class="thumbnail" id="thumbnail_{$vo.id}">
          <img alt="100%x200" src="{:getThumbPath($vo['img_url'])}" data-holder-rendered="true" style="width: 100%; display: block;">
          <div class="caption">
            <h3 style="font-size:12px;">{$vo['title']}</h3>
            <input type="hidden" name="relateids[]" value="{$vo.id}">
          </div>
        </div><a style="position:absolute; top:0px; right:10px; display:inline-block; width:30px; height:30px; line-height:30px; text-align:center; background:#f00; color:#fff;" onClick="$(this).parent().remove();" href="##">x</a></div>
      </gt>
      </volist></div>
      
      <a onClick="relateids();" class="btn btn-success">更改</a>
      </div>
   </div>
    
    
   
     <div class="form-group">
      <label class="col-sm-2 control-label">外部链接</label>
      <div class="col-sm-10">
         <input class="form-control" name="out_link" value="{$info.out_link}" type="text" id="out_link" size="50" />
      </div>
   </div>
   
   
   <div class="form-group">
      <label class="col-sm-2 control-label">本文标签</label>
      <div class="col-sm-10">
         <input class="form-control" name="tags" value="{$info.tags}" type="text" id="tags" size="50" />
      </div>
   </div>
  
   <div class="form-group">
      <label class="col-sm-2 control-label">页面标题</label>
      <div class="col-sm-10">
         <input class="form-control" name="page_title" value="{$info.page_title}" type="text" id="page_title" size="50" />
      </div>
   </div>
   <div class="form-group">
      <label class="col-sm-2 control-label">页面关键字</label>
      <div class="col-sm-10">
        <input class="form-control" value="{$info.keywords}" name="keywords" type="text" id="keywords" size="50" />
      </div>
   </div>
   
   <div class="form-group">
      <label class="col-sm-2 control-label">页面描述</label>
      <div class="col-sm-10">
         <textarea class="form-control" name="description" class="" cols="50" rows="6" id="description">{$info.description}</textarea>
      </div>
   </div></div>
   
      
      <volist name="extendsField" id="vo">
     <div class="setting_table" width="100%" border="0" style="display:none;" cellspacing="0" cellpadding="0">
<volist name="vo['list']" id="svo">
  
  
  
  <div class="form-group">
      <label class="col-sm-2 control-label">{$svo.remark}</label>
      <div class="col-sm-10">
  
  
  <!--单行文本框-->
    <eq name="svo['type']" value="0">
        <input class="form-control" name="extendsField[{$svo.name}]" value="{$extendsField_val[$svo['name']]}" type="text" />
    </eq>
  <!--下拉框-->
    <eq name="svo['type']" value="2">
        <html:select name="extendsField[{$svo['name']}]" class="form-control" options="svo['_select']" selected="extendsField_val[$svo['name']]" />
    </eq>
    <!--编辑框-->
    <eq name="svo['type']" value="3">
        <html:editor id="{$svo['name']}_" class="form-control" name="extendsField[{$svo['name']}]" type="UEDIT" style="width:100%;">{$extendsField_val[$svo['name']]}</html:editor>
    </eq>
    <!--多行文本-->
    <eq name="svo['type']" value="1">
        <textarea class="form-control" name="extendsField[{$svo.name}]" cols="60" rows="6">{$extendsField_val[$svo['name']]}</textarea>
    </eq>
    <!--上传图片-->
    <eq name="svo['type']" value="4">
        <script>
			function uploaded{$svo.name}(path,name){
				$("#"+name).attr("src",'__PUBLIC__'+path);
				$("input[name='extendsField["+name+"]']").val(path);
			}
			function del_img{$svo.name}(name){
				if(confirm('您确定要删除图片吗?')){
					var file=$("input[name='extendsField["+name+"]']").val();
					$.post("{:U('delImgBypath')}",{'path':file},function(data){
						$("input[name='extendsField["+name+"]']").val('');
						$("#"+name).attr('src','');
					});
				}else{
					return false;
				}
			}
			
			
			
			
			
			
			
			
		</script>
        <input type="hidden" name="extendsField[{$svo.name}]" value="{$extendsField_val[$svo['name']]}" />
        <iframe frameborder="0" width="400" height="40" scrolling="no" src="{:U('upload',array('name'=>$svo['name']))}"></iframe>
        <img src="{:getThumbPath($extendsField_val[$svo['name']])}" id="{$svo.name}" height="80" /><a href="javascript:void(0);" onclick="del_img{$svo.name}('{$svo.name}');">删除</a>
    </eq>
    <!--图片上传结束-->
    
  </div></div>
</volist>
</div>

</volist></div>
      
        
      </div><div class="pages"><button type="submit" class="btn btn-success">保存</button></div>
    </form>
  </div>
  <div class="clear"></div>
</div>
<style>
 .numpriceconfiglist{position:relative; margin:5px 0;}
 .numpriceconfiglist input{display:inline; width:auto;}
  .numpriceconfiglist span.close{position:absolute; top:0; right:0;}
</style>
<script>
    function addnumpriceconfig(e){
		$($(e).prev('div').html()).appendTo($(e).parent());
	}
	function deletenumpriceconfig(e){
		$(e).parent().remove();
	}
</script>
</body></html>